#include <qevent.h>
#include <qdebug.h>
#include "QtViewerWidget.h"
#include "SDKCorePrivate.h"

QtViewerWidget::QtViewerWidget(osgViewer::ViewerBase* viewer):
osgEarth::QtGui::ViewerWidget(viewer)
{
}

QtViewerWidget::~QtViewerWidget()
{
}

void QtViewerWidget::resizeEvent(QResizeEvent* event)
{
	int newWidth = event->size().width();
	int newHeight = event->size().height();
	SDKCore::instance()->d_func()->onWindowResize(newWidth,newHeight);
}

void QtViewerWidget::callScript(const QString& script)
{
    auto executor = SDKCore::instance()->getScriptExecutor();
	QString message;
	executor->executeScript(script,&message);
	if(!message.isEmpty())
		qDebug()<<script<<" "<<message;
}